// eslint-disable-next-line
import { UserLayout, BasicLayout, DashboardLayout, PageView, BlankLayout, RouteView } from '@/layouts';

/**
 * 动态路由
 */
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/dashboard',
    children: [
      // 企业信息
      {
        path: '/company/settings',
        name: 'settings',
        component: () => import('@/views/company/settings/Index'),
        meta: { title: '企业信息', icon: 'dashboard', permission: ['admin', 'super_admin'] },
        redirect: '/company/settings/base',
        hideChildrenInMenu: true,
        children: [
          {
            path: '/company/settings/base',
            name: 'baseSettings',
            component: () => import('@/views/company/settings/BaseSetting'),
            meta: { title: '基础信息', permission: ['admin', 'super_admin'] }
          },
          {
            path: '/company/settings/auth',
            name: 'authSettings',
            component: () => import('@/views/company/settings/AuthSetting'),
            meta: { title: '登录方式', permission: ['admin', 'super_admin'] }
          },
          {
            path: '/company/settings/msg',
            name: 'msgSettings',
            component: () => import('@/views/company/settings/msgSetting'),
            redirect: '/company/settings/msg/sys-info',
            meta: { title: '消息通知设置', permission: ['admin', 'super_admin'] },
            children: [
              {
                path: '/company/settings/msg/sys-info',
                name: 'sysInfo',
                component: () => import('@/views/company/settings/msgSetting/SysInfo'),
                meta: { title: '系统信息', permission: ['admin', 'super_admin'] }
              },
              {
                path: '/company/settings/msg/companyWx-config',
                name: 'companyWxConfig',
                component: () => import('@/views/company/settings/msgSetting/CompanyWxConfig'),
                meta: { title: '企业微信设置', permission: ['admin', 'super_admin'] }
              },
              {
                path: '/company/settings/msg/mail-config',
                name: 'mailConfig',
                component: () => import('@/views/company/settings/msgSetting/MailConfig'),
                meta: { title: '邮件通知设置', permission: ['admin', 'super_admin'] }
              }
            ]
          }
        ]
      },
      // 应用管理
      {
        path: '/applications',
        name: 'applications',
        component: BlankLayout,
        meta: { title: '应用管理', icon: 'appstore', permission: ['admin', 'super_admin'] },
        redirect: '/applications',
        hideChildrenInMenu: true,
        children: [
          {
            path: '/applications/app/:id?',
            name: 'applicationItem',
            component: () => import('@/views/application/Item'),
            meta: { title: '应用信息', permission: ['admin', 'super_admin'] }
          },
          {
            path: '/applications',
            name: 'applicationList',
            component: () => import('@/views/application/List'),
            meta: { title: '应用列表', permission: ['admin', 'super_admin'] }
          },
          {
            path: '/baseDataConfig',
            name: 'baseDataConfig',
            component: () => import('@/views/application/BaseDataConfig'),
            meta: { title: '平台基础数据配置', permission: ['admin', 'super_admin'] }
          },
          {
            path: '/applications/message-config',
            name: 'messageConfig',
            component: () => import('@/views/application/messageConfig'),
            meta: { title: '消息通知配置', permission: ['admin', 'super_admin'] },
            redirect: '/applications/message-config/sys-info',
            children: [
              {
                path: '/applications/message-config/sys-info',
                name: 'appSysInfo',
                component: () => import('@/views/application/messageConfig/SysInfo'),
                meta: { title: '系统信息', permission: ['admin', 'super_admin'] }
              },
              {
                path: '/applications/message-config/companyWx-config',
                name: 'appCompanyWxConfig',
                component: () => import('@/views/application/messageConfig/CompanyWxConfig'),
                meta: { title: '企业微信设置', permission: ['admin', 'super_admin'] }
              },
              {
                path: '/applications/message-config/mail-config',
                name: 'appMailConfig',
                component: () => import('@/views/application/messageConfig/MailConfig'),
                meta: { title: '邮件通知设置', permission: ['admin', 'super_admin'] }
              }
            ]
          }
        ]
      },
      // 平台管理员
      {
        path: '/users',
        name: 'users',
        component: BlankLayout,
        meta: { title: '平台管理员', icon: 'team', permission: ['admin', 'super_admin'] },
        redirect: '/users',
        hideChildrenInMenu: true,
        children: [
          {
            path: '/user/:id',
            name: 'user',
            hidden: true,
            component: () => import('@/views/user/Item'),
            meta: { title: '人员信息', permission: ['admin', 'super_admin'] }
          },
          {
            path: '/users',
            name: 'usersList',
            component: () => import('@/views/user/List'),
            meta: { title: '平台管理员', permission: ['admin', 'super_admin'] }
          }
        ]
      },
      // 个人中心
      {
        path: '/account',
        name: 'account',
        component: () => import('@/views/account/Index'),
        meta: { title: '个人中心', icon: 'dashboard' },
        redirect: '/account/base',
        hideChildrenInMenu: true,
        children: [
          {
            path: '/account/base',
            name: 'accountBase',
            component: () => import('@/views/account/BaseInfo'),
            meta: { title: '基本信息' }
          },
          {
            path: '/account/security',
            name: 'accountSecurity',
            component: () => import('@/views/account/Security'),
            meta: { title: '安全设置' }
          },
          {
            path: '/account/shiftConfig',
            name: 'accountShiftConfig',
            component: () => import('@/views/account/ShiftConfig'),
            meta: { title: '工作班次设置', permission: ['admin', 'super_admin'] }
          }
        ]
      },
      {
        name: 'authenticationCenter',
        meta: { title: '权限配置', icon: 'setting', permission: ['admin', 'super_admin'] },
        path: '/authenticationCenter',
        redirect: '/authenticationCenter/menuConfig',
        component: PageView,
        children: [
          {
            name: 'menuConfig',
            meta: { icon: 'menu', permission: ['admin', 'super_admin'] },
            path: '/authenticationCenter/menuConfig',
            component: () => import('@/views/authenticationCenter/MenuConfig')
          },
          {
            name: 'roleConfig',
            meta: { icon: 'user', permission: ['admin', 'super_admin'] },
            path: '/authenticationCenter/roleConfig',
            redirect: '/authenticationCenter/roleConfig/role',
            component: RouteView,
            hideChildrenInMenu: 'true',
            children: [
              {
                name: 'role',
                meta: { permission: ['admin', 'super_admin'] },
                path: '/authenticationCenter/roleConfig/role',
                component: () => import('@/views/authenticationCenter/RoleConfig')
              },
              {
                name: 'roleForm',
                meta: { icon: 'user', permission: ['admin', 'super_admin'] },
                path: '/authenticationCenter/roleConfig/roleForm',
                component: () => import('@/views/authenticationCenter/RoleForm')
              }
            ]
          },
          {
            name: 'userGroup',
            meta: { icon: 'team', permission: ['admin', 'super_admin'] },
            path: '/authenticationCenter/userGroup',
            component: () => import('@/views/authenticationCenter/userGroup')
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 */
export const constantRouterMap = [
  {
    name: 'sso',
    path: '/sso',
    component: () => import(/* webpackChunkName: "auth" */ '@/views/auth/SSO'),
    hidden: true
  },
  {
    path: '/login',
    component: UserLayout,
    redirect: '/login',
    hidden: true,
    children: [
      {
        path: '/',
        name: 'login',
        component: () => import(/* webpackChunkName: "auth" */ '@/views/auth/Login')
      }
    ]
  },
  {
    path: '/dashboard',
    component: DashboardLayout,
    hidden: true,
    children: [
      {
        path: '/',
        name: 'dashboard',
        component: () => import(/* webpackChunkName: "dashboard" */ '@/views/dashboard/Index')
      }
    ]
  },
  {
    path: '/404',
    name: '404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
